
//
//  MusicView.m
//  CarOfHome2
//
//  Created by dlios on 15/9/23.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MusicView.h"

@implementation MusicView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.background = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
        
        self.background.image = [UIImage imageNamed:@"background2.jpg"];
        [self addSubview:self.background];
        UIVisualEffectView *effect = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
        effect.frame = CGRectMake(0, 0, 375 * SAWindth, 667 * SAHeight);
        [self.background addSubview:effect];
        UIVisualEffectView *effect1 = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
        effect1.frame = CGRectMake(25 * SAWindth, 132.5 * SAHeight, 325 * SAWindth, 325 * SAHeight);
        effect1.alpha = 1;
        effect1.layer.cornerRadius = 162.5;
        effect1.layer.masksToBounds = YES;
        [self.background addSubview:effect1];

        
        self.back = [UIButton buttonWithType:UIButtonTypeCustom];
        self.back.frame = CGRectMake(0, 0, 50 * SAWindth, 100 * SAHeight);
        [self.back setImage:[UIImage imageNamed:@"back1.png"] forState:UIControlStateNormal];
        [self addSubview:self.back];
        
        self.backList = [UIButton buttonWithType:UIButtonTypeCustom];
        self.backList.frame = CGRectMake(0, 80 * SAHeight, 375 * SAWindth, 400 * SAHeight);
       
        [self addSubview:self.backList];
        
        self.songName = [[UILabel alloc] initWithFrame:CGRectMake(50 * SAWindth, 15 * SAHeight, 300 * SAWindth, 60 * SAHeight)];
        self.songName.font = [UIFont systemFontOfSize:20];
        self.songName.textColor = [UIColor whiteColor];
        self.songName.shadowColor = [UIColor colorWithRed:71/255.0f green:74/255.0f blue:79/255.0f alpha:0.85];
        self.songName.shadowOffset = CGSizeMake(1.5,1.5);
        [self addSubview:self.songName];
        
        self.singer = [[UILabel alloc] initWithFrame:CGRectMake(50 * SAWindth, 42 * SAHeight, 200 * SAWindth, 40 * SAHeight)];
        self.singer.font = [UIFont systemFontOfSize:14];
        self.singer.textColor = [UIColor whiteColor];
        self.singer.shadowColor = [UIColor colorWithRed:71/255.0f green:74/255.0f blue:79/255.0f alpha:0.85];
        self.singer.shadowOffset = CGSizeMake(1.5,1.5);
        [self addSubview:self.singer];
        
        
        self.like = [UIButton buttonWithType:UIButtonTypeCustom];
        self.like.frame = CGRectMake(300 * SAWindth, 20 * SAHeight, 60 * SAWindth, 60 * SAHeight);
        [self.like setImage:[UIImage imageNamed:@"likeOff.png" ] forState:UIControlStateNormal];
        [self addSubview:self.like];
        
        self.photobg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"photobg.png"]];
        self.photobg.frame = CGRectMake(37.5 * SAWindth, 145 * SAHeight, 300 * SAWindth, 300 * SAHeight);
        self.photobg.layer.cornerRadius = 150;
        self.photobg.layer.masksToBounds = YES;
       // self.photobg.backgroundColor = [UIColor grayColor];
        [self addSubview:self.photobg];
        self.photo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.jpg"]];
        self.photo.frame = CGRectMake(52, 52, 197, 197);
        self.photo.layer.cornerRadius = 98.5;
        self.photo.layer.masksToBounds = YES;
        [self.photobg addSubview:self.photo];
        
        
        self.leftTime = [[UILabel alloc] initWithFrame:CGRectMake(20 * SAWindth, 505 *SAHeight, 40 * SAWindth, 30 * SAHeight)];
        self.leftTime.font = [UIFont systemFontOfSize:14];
        self.leftTime.textColor = [UIColor whiteColor];
        self.leftTime.shadowColor = [UIColor colorWithRed:71/255.0f green:74/255.0f blue:79/255.0f alpha:0.85];
        self.leftTime.shadowOffset = CGSizeMake(1.5,1.5);
        [self addSubview:self.leftTime];
        
        self.rightTime = [[UILabel alloc] initWithFrame:CGRectMake(325 * SAWindth, 505 * SAHeight, 40 *SAWindth, 30 * SAHeight)];
        self.rightTime.font = [UIFont systemFontOfSize:14];
        self.rightTime.textColor = [UIColor whiteColor];
        self.rightTime.shadowColor = [UIColor colorWithRed:71/255.0f green:74/255.0f blue:79/255.0f alpha:0.85];
        self.rightTime.shadowOffset = CGSizeMake(1.5,1.5);
        [self addSubview:self.rightTime];
        
        
        self.plan = [[UISlider alloc] initWithFrame:CGRectMake(60 * SAWindth, 510 * SAHeight, 255 * SAWindth, 20 * SAHeight)];
        self.plan.minimumValue = 0;
        self.plan.maximumValue = 1;
        [self.plan setThumbImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AudioPlayerVolumeKnob" ofType:@"png"]] forState:UIControlStateNormal];
        
        [self.plan setMinimumTrackImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AudioPlayerScrubberLeft" ofType:@"png"]] forState:UIControlStateNormal];
        
        [self.plan setMaximumTrackImage:[[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AudioPlayerScrubberRight" ofType:@"png"]] stretchableImageWithLeftCapWidth:5 topCapHeight:3] forState:UIControlStateNormal];

//        self.plan.minimumTrackTintColor = [UIColor lightGrayColor];
//        self.plan.maximumTrackTintColor = [UIColor orangeColor];
        [self.plan setValue:0 animated:YES];
        [self addSubview:self.plan];

        self.volume = [[UISlider alloc] initWithFrame:CGRectMake(290 * SAWindth, 580 * SAHeight, 100 * SAWindth, 20 * SAHeight)];
        self.volume.minimumValue = 0.0f;
        self.volume.maximumValue = 10.0f;
        [self.volume setThumbImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"AudioPlayerVolumeKnob" ofType:@"png"]] forState:UIControlStateNormal];
        self.volume.minimumTrackTintColor = [UIColor lightGrayColor];
        self.volume.maximumTrackTintColor = [UIColor orangeColor];
        [self.volume setValue:3.0f animated:YES];
        self.volume.transform = CGAffineTransformMakeRotation(-1.57079633);
        [self addSubview:self.volume];
        
        self.last = [UIButton buttonWithType:UIButtonTypeCustom];
        self.last.frame = CGRectMake(95 * SAWindth, 570 * SAHeight, 50 * SAWindth, 50 * SAHeight);
        [self.last setImage:[UIImage imageNamed:@"last.png"] forState:UIControlStateNormal];
        [self addSubview:self.last];
        
        self.play = [UIButton buttonWithType:UIButtonTypeCustom];
        self.play.frame = CGRectMake(175 * SAWindth, 570 * SAHeight, 50 * SAWindth, 50 * SAHeight);
         [self.play setImage:[UIImage imageNamed:@"start.png"] forState:UIControlStateNormal];
        [self addSubview:self.play];
        
        self.next = [UIButton buttonWithType:UIButtonTypeCustom];
        self.next.frame = CGRectMake(255 * SAWindth, 570 * SAHeight, 50 * SAWindth, 50 * SAHeight);
        [self.next setImage:[UIImage imageNamed:@"next.png"] forState:UIControlStateNormal];
        [self addSubview:self.next];
        
        
        
        
    }
    return self;
}

@end
